<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <div>
       <canvas id="cvs" width="400" height="400" style="border:1px solid black"></canvas>
    </div>
    <script>
       var canvas = document.getElementById('cvs');
       var ctx = canvas.getContext("2d");
       ctx.setLineDash([5,2]);
       ctx.strokeRect(10,20,50,100)
       
    </script>
</body>
</html>